package com.xinruke.hostels.common.fallback;

import com.xinruke.hostels.common.vo.ResultVO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

/**
 * @ClassName FeignFallback
 * @CreateDate 2019/6/9
 * @Author FengXinQiang
 * @Version V1.0.0.0
 * @Decription 服务调用熔断处理
 */
@Component
public class FeignFallback {
    Logger logger = LoggerFactory.getLogger(this.getClass());

    public ResultVO doFallback(Class<?> className, String methodName, String message) {
        logger.warn("熔断处理，className[" + className.toString() + "]methodName[" + methodName + "]message[" + message + "]");

        ResultVO resultVO = ResultVO.fail();
        resultVO.setMessage("服务无效，请联系管理员");

        return resultVO;
    }
}
